home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 466 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  978 b 

  1. Path: solon.com!not-for-mail
  2. From: yang@math.umass.edu (Huayong Yang)
  3. Newsgroups: comp.lang.c,comp.lang.c.moderated
  4. Subject: Re: Leading and Trailing Blanks
  5. Date: 5 Jan 1996 09:53:40 -0600
  6. Organization: UMass/Amherst Dept Math & Stats
  7. Sender: clc@solutions.solon.com
  8. Approved: clc@solutions.solon.com
  9. Message-ID: <4cjhi4$fa2@solutions.solon.com>
  10. References: <4chh1b$685@solutions.solon.com>
  11. NNTP-Posting-Host: solutions.solon.com
  12. X-Newsreader: Tin 1.1 PL362948
  13.  
  14.  
  15. mskc@io.com (Casey Claiborne) writes:
  16. :     I am wondering if anyone out there has a program (or knows of one)
  17. : that allows one to strip leading and trailing blanks from a string. 
  18. : ex:
  19. :     char test[20];
  20. :     strcpy(test,"  TESTING  ");
  21. :     printf("%s", test);
  22.  
  23. How about this:
  24.  
  25.      char test[20], temp[20];
  26.      strcpy(test,"  TESTING  ");
  27.         sscanf(test, "%s", temp);
  28.      printf("%s", temp);
  29.  
  30. --
  31. Huayong
  32.  
  33. WWW home pages:                           Email:
  34. http://www.math.umass.edu/~yang           yang@math.umass.edu
  35.